package com.heima.kafka.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaConsumerListener {

    @KafkaListener(topics = "kafka.topic.my-topic1",groupId="group1")
    public void listenTopic1group1(ConsumerRecord<String,String> record){
        String key=record.key();
        String value=record.value();
        System.out.println("group1中的消费者接收消息："+key+":"+value);
    }
}
